
var SocialLastfm = function( type ) {
	
	Object.extend ( obj = $$('.SocialLastfm').pop(), SocialLastfm_proto );
	obj.type = type;
	
	obj.childs = obj.select( "li.tag" );
	obj[ "init_" + type ]();

	return obj;
}


var SocialLastfm_proto	= {
	
	init_toptracks	: function() {
		
		this.movie = this.select('.movie')[0].hide();
		this.player = this.movie.firstChild.remove();
		this.childs.each( this.childobserve.bind( this ) );
	},
	
	childobserve	: function( el ) {
		
		el.observe( "click", this.toptracks_load_src.bind( this ) );
	},
	
	toptracks_load_src	: function( e ) {

		this.childs.invoke( "removeClassName", "active" );
		li = e.currentTarget.addClassName( "active" );
	
		ref = li.attributes.getNamedItem("ref").value;
		
		this.player.src = this.source + ref;
		this.movie.update( this.player );
		this.select('.movie')[0].show();
	}
}
